<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="sysDefault" />
<script
	src="${staticPath}/lib/jquery-datatables/1.9.4/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function() {
	});
	function funform(url,target){
		window.open(url,target);
	}
	
	function redirect(href){
		window.open(href); 
	}
	
	function createFtl(id){
		$.ajax({
	        type: "GET",
	        url: "${contextPath}/biz/contract/template/create?id="+id,
	        data: null,
	        dataType: "json",
	        success: function(data){
	        	$.jBox.tip("生成文本成功！！！");
	        }
	    });
	}
	
</script>
</head>
<body>
	<form:form name="listForm" action="" method="post" class="form-inline" role="form">
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">
				    	合同模板列表
						<button class="btn btn-success btn-sm pull-right" onclick="funform('${contextPath}/biz/contract/template/showEditPage','_self');">新增</button>
				    </h3>
				  </div>
				  	<tags:message content="${message}"/>
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>编号</th>
								<th>模板名称</th>
								<th>创建人</th>
								<th>创建时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${list}" var="template">
								<tr>
									<td>${template.id}</td>
									<td>${template.templateName}</td>
									<td>${template.createBy}</td> 
									<td><fmt:formatDate value="${template.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
									<td>
										<a href="Javascript:void(0)" onclick="redirect('${contextPath}/biz/contract/template/preview?id=${template.id }')">预览</a>
										<a href="javascript:void(0)" onclick="createFtl('${template.id}')">生成文本</a>
										<a href="${contextPath}/biz/contract/template/showEditPage?id=${template.id }">修改</a>
										<a href="${contextPath}/biz/contract/template/del?id=${template.id }"
										   onclick="return Oosp_Confirm('确认要删除该条数据吗？', this.href)">删除</a>   
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				  <pager:pager pageSize="${page.pageSize}" pageNo="${page.pageNo}" url="" total="${page.total}"/>
				  <script type="text/javascript" src="${staticPath}/js/list.js"></script>
				</div>			
			</div>
		</div>
	</div>
	</form:form>
</body>
</html>